package com.example.demo.controller;

import com.example.demo.mode.PrintFileOperation;
import com.example.demo.service.PrintFileOperationHistoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 21024
 */

@CrossOrigin(origins = "*")
@ResponseBody
@RequestMapping("/print")
@Slf4j
@Controller
public class PrintFileOperationsCollect {
    private final PrintFileOperationHistoryService printFileOperationHistoryService;

    @Autowired
    public PrintFileOperationsCollect(PrintFileOperationHistoryService printFileOperationHistoryService) {
        this.printFileOperationHistoryService = printFileOperationHistoryService;
    }

    @GetMapping("/operationList/{name}")
    public List<PrintFileOperation> operationList(@PathVariable(value = "name") String fileName) {
        return printFileOperationHistoryService.findAllFileName(fileName);
    }
}
